package com.rules.admin.publish;


import com.rules.admin.entity.RulePackage;

public class DefaultPublisher implements Publisher {
   private Notifier notifier;
   private static final String MES = "SUCCESS";

   public String publish(RulePackage rulePackage) {
      String result = this.executeRuleParser();
      if ("SUCCESS".equals(result)) {
         result = this.executeUnitTest();
         if ("SUCCESS".equals(result)) {
            this.notifier.notify(rulePackage);
         }
      }

      return result;
   }

   private String executeUnitTest() {
      return "SUCCESS";
   }

   private String executeRuleParser() {
      return "SUCCESS";
   }

   public void setNotifier(Notifier notifier) {
      this.notifier = notifier;
   }
}
